package com.ry;

import com.ry.util.timepick.R;
import android.app.Activity;
import android.content.Intent;
import android.os.Bundle;
import android.view.View;
import android.view.View.OnClickListener;
import android.widget.Button;
import android.widget.EditText;
import android.widget.Toast;

public class InvoiceInformationActivity extends Activity {
	private Button btnBack;
	private Button btnConfirm;
	private EditText edtInvoiceHead;
	private EditText edtReceiverName;
	private EditText edtAddress;
	private EditText edtEmail;

	@Override
	protected void onCreate(Bundle savedInstanceState) {
		super.onCreate(savedInstanceState);
		setContentView(R.layout.invoice_information);
		init();
	}

	private void init() {
		btnBack = (Button) findViewById(R.invoice_information.btn_back);
		btnConfirm = (Button) findViewById(R.invoice_information.btn_confirm);
		edtInvoiceHead = (EditText) findViewById(R.invoice_information.edt_invoice_head);
		edtReceiverName = (EditText) findViewById(R.invoice_information.edt_reciever_name);
		edtAddress = (EditText)findViewById(R.invoice_information.edt_address);
		edtEmail = (EditText)findViewById(R.invoice_information.edt_email);

		btnBack.setOnClickListener(new OnClickListener() {
			@Override
			public void onClick(View v) {
				InvoiceInformationActivity.this.finish();
			}
		});

		btnConfirm.setOnClickListener(new OnClickListener() {
			@Override
			public void onClick(View v) {
				if("".equals(edtInvoiceHead.getText().toString().trim())){
					Toast.makeText(InvoiceInformationActivity.this, "请输入发票抬头。", Toast.LENGTH_SHORT).show();
					return;
				}
				if("".equals(edtReceiverName.getText().toString().trim())){
					Toast.makeText(InvoiceInformationActivity.this, "请输入收件人姓名。", Toast.LENGTH_SHORT).show();
					return;
				}
				if("".equals(edtAddress.getText().toString().trim())){
					Toast.makeText(InvoiceInformationActivity.this, "请输入地址。", Toast.LENGTH_SHORT).show();
					return;
				}
				if("".equals(edtEmail.getText().toString().trim())){
					Toast.makeText(InvoiceInformationActivity.this, "请输入邮箱。", Toast.LENGTH_SHORT).show();
					return;
				}
				Toast.makeText(InvoiceInformationActivity.this, "保存成功。", Toast.LENGTH_SHORT).show();
				Intent intent = new Intent(InvoiceInformationActivity.this, OrderConfirmActivity.class);
				startActivity(intent);
			}
		});
	}

}
